import {reqGetUserAddress,reqGetTradeData} from '@/api'
export default({
    state:{
        addressList:[],
        tradeData:{}
    },
    mutations:{
        GETUSERADDRESS(state,addressList){
            state.addressList=addressList;
        },
        GETTRADEDATA(state,tradeData){
            state.tradeData=tradeData;
        }
    },
    actions:{
        async getUserAddress({commit}){
            let result = await reqGetUserAddress();
            if(result.code==200){
                console.log("address",result.data)
                commit("GETUSERADDRESS",result.data)
            }
        },
        async getTradeData({commit}){
            let result = await reqGetTradeData();
            if(result.code==200){
                console.log("tradedata",result.data)
                commit("GETTRADEDATA",result.data)
            }
        }
    },
    getters:{
        addressList(state){
            return state.addressList;
        }
    }
})